<template>
  <div class="cluster recovery">
    <a-card style="width: 100%">
      <p slot="title" class="cardTitles">
        <span>题目列表</span>
        <!-- <a-upload
            name="file"
            :multiple="true"
            action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
            class="upload"
        >
        <a-button>上传</a-button>
        </a-upload>
        <a-button type="primary">模板</a-button> -->
      </p>
      <!-- <div class="formDiv">
        <a-form layout="inline">
          <a-form-item label="题目关键词">
            <a-input v-model="keywords" type="text" style="width: 180px" />
          </a-form-item>
          <a-form-item>
            <a-button type="primary">搜索</a-button>
          </a-form-item>
          <a-form-item>
            <a-button>重置</a-button>
          </a-form-item>
        </a-form>
      </div> -->
      <div style="margin-top: 20px" class="table-content">
        <a-table
          bordered
          :columns="columns"
          :data-source="list"
          rowKey="id"
          :pagination="pagination"
        >
          <template slot-scope="text, record" slot="action">
            <a class="tools" @click="detail(record)">详情</a>
          </template>
        </a-table>
      </div>
    </a-card>
  </div>
</template>

<script>
import addModel from "components/configuration/management/addModel";
import question from "@/assets/json/questionList.js";
import { paging } from "assets/js/mixin";
export default {
  mixins: [paging],
  components: {
    addModel,
  },
  data() {
    return {
      //是否显示弹框
      managementVisible: false,
      managementId: "",
      managementType: 0, //0新增1是编辑
      disabled: true,
      userinformVisible: false,
      userApplicationVisible: false,
      keyName: "2",
      keywords: "",
      numbers: 0,
      selectedRowKeys: [],
      columns: [
        {
          title: "题目id",
          dataIndex: "id",
          scopedSlots: { customRender: "id" },
          sorter: (a, b) => a.id - b.id,
        },
        {
          title: "题目内容",
          dataIndex: "question",
        },
        {
          title: "创建时间",
          dataIndex: "createTime",
        },
        {
          title: "操作",
          dataIndex: "action",
          scopedSlots: { customRender: "action" },
        },
      ],
      list: [],
      formLayout: {
        spanCol: { span: 6 },
        wrapperCol: { span: 18 },
      },
      inputValue: "",
    };
  },
  mounted () {
    this.list =question();
  },
  methods: {
    addManagement() {
      this.managementVisible = true;
    },
    detail(recode){
        console.log(recode)
        this.$router.push({name: 'questionDetail',query: {id:recode.id,question:recode.question}})
    }
  },
};
</script>

<style lang="stylus" scoped>
.formDiv {
  .lable {
    margin-right: 10px;
  }
}

.upload {
  float: right;
}

.recovery {
  height: 100%;
}

.table-content {
  height: calc(100% - 138px);
  overflow: auto;
}

.ant-card-body {
  height: 100%;
}
</style>